#include "jabstractcandidatepanel.h"
#include <QKeyEvent>

namespace QTE
{

JAbstractCandidatePanel::JAbstractCandidatePanel(QWidget *parent) :
	QWidget(parent)
{

}

JAbstractCandidatePanel::~JAbstractCandidatePanel()
{

}

void JAbstractCandidatePanel::predicts(const QString&)
{

}

void JAbstractCandidatePanel::input(const QString &text)
{
	if( not text.isEmpty() )
	{
		QString tmp = text;
		if( tmp.size() == 2 and tmp[0] == tmp[1] )
			tmp = tmp[0];

		emit postKeyEvent(new QKeyEvent(QEvent::KeyPress, 0, Qt::NoModifier, tmp));
		emit postKeyEvent(new QKeyEvent(QEvent::KeyRelease, 0, Qt::NoModifier, tmp));
	}
}

void JAbstractCandidatePanel::input(Qt::Key key)
{
	emit postKeyEvent(new QKeyEvent(QEvent::KeyPress, key, Qt::NoModifier));
	emit postKeyEvent(new QKeyEvent(QEvent::KeyRelease, key, Qt::NoModifier));
}

void JAbstractCandidatePanel::defaultInput()
{

}

} //namespace QTE
